<template>
	<div>
		<c_header title="个人中心" :leftOptions="{backText: ''}" :rightOptions="{showMore: true}"></c_header>
		<c_sidemenu></c_sidemenu>
		<group>
			<cell-box is-link>浏览记录</cell-box>
			<cell-box is-link @click.native="clearShow = true">清除缓存</cell-box>
			<cell-box>版本号：V-1.0.1</cell-box>
		</group>
		<actionsheet v-model="clearShow" :menus="historyClearSelect" :close-on-clicking-mask="true" show-cancel @on-click-menu="historyClear" ></actionsheet>
	</div>
</template>

<script>
import c_header from '@/components/c_header'
import c_sidemenu from '@/components/c_sidemenu'
import { Group, Cell, CellBox, Actionsheet } from 'vux'

export default {
	data () {
		return {
			clearShow: false,
			historyClearSelect: {
				d3: '清除3天前的记录',
				d0: '清除所有记录'
			}
		}
	},
	methods: {
		historyClear (key) {
			switch (key) {
				case 'd3':
					
					this.$vux.alert.show('已成功清除3天前的记录')
					break
				case 'd0':
					localStorage.clear()
					this.$vux.alert.show('已成功清除所有记录')
					break
				defaut:
					console.error('history clear error')
					break
			}
		}
	},
	components: {
		c_header, c_sidemenu, Group, Cell, CellBox, Actionsheet 
	}
}
</script>

<style>
html, body{height: 100%;}
</style>